﻿using System.Collections.Generic;

namespace CodeContrib
{
	public class RandomBoolean : IRandom<bool>
	{
		private static readonly IEnumerable<bool> _booleanValues;
		private readonly RandomItem<bool> _randomBoolean;

		static RandomBoolean()
		{
			_booleanValues = new[]
				                 {
					                 true, false
				                 };
		}

		public RandomBoolean()
		{
			_randomBoolean = new RandomItem<bool>(_booleanValues);
		}

		public bool Next()
		{
			return _randomBoolean.Next();
		}
	}
}